import request from "@/utils/request"

// 获取所有课程列表
export const queryAllCourse = (title,page, pageSize) => {
    return request.get('/course', {
        params: {
            title: title, 
            page: page, 
            pageSize: pageSize 
        }
    }).then((result) => result.data)
}

// 根据id查询课程
export const queryCourseById = (id) => {
    return request.get(`/course/${id}`).then((result) => result.data) 
}
//删除课程信息
export const deleteCourse=(ids) => {
    return request.delete('/course',{
        params:{
            ids:ids 
        }
    })
   .then((result) => result.data)
}

//添加课程信息
export const addCourse = (data) => {
    return request.post('/course', data)
  .then((result) => result.data)
}

//修改课程信息
export const updateCourse = (data) => {
    return request.put('/course', data)
    .then((result) => result.data) 
}